#ifndef _DATA_POOL_H_
#define _DATA_POOL_H_

#include <stdlib.h> 

//typedef unsigned char size_t;

/* data type for data in the pool*/
#define DATA_TYPE unsigned char


#define FAIL             -1
#define DATA_POOL_FULL   -2
#define DATA_POOL_EMPTY  -3


typedef struct
{
    void *(*malloc_fn)(size_t sz);
    void (*free_fn)(void *ptr);
} MemoryHooks;

typedef struct DataPool DataPool;

extern void poolInitMemoryHooks(MemoryHooks *hooks);

extern DataPool *createDataPool(size_t size);

extern int releaseDataPool(DataPool * const obj);

extern int writeToDataPool(DataPool * const obj, DATA_TYPE *buf, size_t len);

extern int readFromDataPool(DataPool * const obj, DATA_TYPE *buf, size_t len);

//extern int isDataPoolFull(DataPool * const obj);

//extern int isDataPoolEmpty(DataPool * const obj);

#endif
